﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace QLNH.MyUserControls
{
    public partial class LeftMenuButtonUC : UserControl
    {
        private string _buttonName;
        public string ButtonName
        {
            get { return _buttonName; }
            set { _buttonName = value; this.lb_buttonName.Text = _buttonName; }
        }

        private int _index;
        public int Index
        {
            get { return _index; }
            set { _index = value; }
        }

        private bool _pressed;
        public bool Pressed
        {
            get { return _pressed; }
            set { _pressed = value; }
        }

        public LeftMenuButtonUC()
        {
            InitializeComponent();
            this.BackgroundImage = imageList.Images[0];
            _pressed = false;
            _index = 0;
        }

        private void LeftMenuButtonUC_MouseEnter(object sender, EventArgs e)
        {
            if (!_pressed)
                this.BackgroundImage = imageList.Images[1];
        }

        private void LeftMenuButtonUC_MouseLeave(object sender, EventArgs e)
        {
            if (!_pressed)
                this.BackgroundImage = imageList.Images[0];
        }

        private void lb_buttonName_MouseEnter(object sender, EventArgs e)
        {
            base.OnMouseEnter(e);
        }

        private void lb_buttonName_MouseLeave(object sender, EventArgs e)
        {
            base.OnMouseLeave(e);
        }

        private void LeftMenuButtonUC_Click(object sender, EventArgs e)
        {
            ChangeBackGroundImage();
        }

        public void ChangeBackGroundImage()
        {
            if (_pressed)
            {
                this.BackgroundImage = imageList.Images[1];
            }
            else
            {
                this.BackgroundImage = imageList.Images[0];
            }

        }

        private void lb_buttonName_Click(object sender, EventArgs e)
        {
            base.OnClick(e);
        }
    }
}
